package com.ojoin.trade.supplyloan_core.web.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ojoin.trade.common.utils.CommonUtils;
import com.ojoin.trade.supplyloan_core.web.domain.*;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.exception.DaoException;
import com.ojoin.trade.common.utils.TimeUtils;
import com.ojoin.trade.common.web.dao.impl.BaseDaoImpl;
import com.ojoin.trade.supplyloan_core.web.dao.TbSlLoanCreditDao;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 15-10-22
 * Time: 上午11:39
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class TbSlLoanCreditDaoImpl extends BaseDaoImpl<TbSlLoanCreditLog> implements TbSlLoanCreditDao {
    @Override
    public void insertTbSlLoanCredit(TbSlLoanCreditLog creditLogvo) throws BusinessException {
        String mapMethodName ="insert";
        try{
            this.sqlSessionTemplate.insert(getSqlName(mapMethodName),creditLogvo);
        }catch (Exception e) {
            throw new DaoException(String.format("插入商户贷款出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }

    }

    @Override
    public int updateTbSlLoanCredit(Map<String, Object> paramsmap) throws BusinessException {
        String mapMethodName ="update";
        try{
            return this.sqlSessionTemplate.update(getSqlName(mapMethodName),paramsmap);
        }catch (Exception e) {
            throw new DaoException(String.format("更新商户贷款出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }


    @Override
    public List<TbSlLoanCreditLog> queryNotPayBackCreditLogByJoinid(int userIdOfIPayNowOfDebtor,Pageable page) throws BusinessException {
        String mapMethodName = "selectByJoinid";
        try {

                return sqlSessionTemplate.selectList(
                        getSqlName(mapMethodName),
                        userIdOfIPayNowOfDebtor, this.getPageBounds(page));
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户未还清贷款记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public List<TbSlLoanCreditLog> queryNotPayBackCreditLogByJoinidNotpage(int userIdOfIPayNowOfDebtor) throws BusinessException {
        String mapMethodName = "selectByJoinid";
        try {

            return sqlSessionTemplate.selectList(
                    getSqlName(mapMethodName),
                    userIdOfIPayNowOfDebtor);
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户未还清贷款记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public List<TbSlLoanCreditLogVo> queryAllNotPayBackCreditLog(int userIdOfJoinOfCreditor) throws BusinessException {
        String mapMethodName = "selectAllNotPayBack";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),userIdOfJoinOfCreditor);
            if (list != null && list.size() >0)
                return list ;
        } catch (Exception e) {
            throw new DaoException(String.format("查询所有用户未还清贷款记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
        return null;
    }

    @Override
    public List<TbSlStatusCreditLogVo> queryCreditLogByStatus(int creditstatus,int userIdOfJoinOfCreditor, Pageable page) throws BusinessException {
        Map<String,Object> paramap=new HashMap<String,Object>();
        paramap.put("creditstatus",creditstatus);
        paramap.put("userIdOfJoinOfCreditor",userIdOfJoinOfCreditor);
        String mapMethodName = "selectByStatus";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),paramap,this.getPageBounds(page));
            if (list != null && list.size() >0)
                return list ;
        } catch (Exception e) {
            throw new DaoException(String.format("查询状态用户的贷款查询记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
        return null;
    }

    @Override
    public TbSlLoanCreditLog queryCreditLogById(int id) throws BusinessException {
        return selectById(id);
    }

    @Override
    public String querySumApplyLoanByJoinid(int userIdOfIPayNowOfDebtor) throws BusinessException {
        String mapMethodName = "selectSumApplyLoanByJoinid";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),userIdOfIPayNowOfDebtor);
            if (list != null && list.size() >0)
                return (String)list.get(0) ;
        } catch (Exception e) {
            throw new DaoException(String.format("查询状态用户的贷款查询记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
        return null;
    }


    @Override
    public String selectCreditLoanCountByJoinid(int joinuserid) throws BusinessException {
        String mapMethodName = "selectCreditLoanCountByJoinid";
        try {
            return this.sqlSessionTemplate.selectOne(getSqlName(mapMethodName),joinuserid);
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户的贷款次数出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public String selectNotcompleteCreditLoanByJoinid(int joinuserid) throws BusinessException {
        String mapMethodName = "selectNotcompleteCreditLoanByJoinid";
        try {
            return this.sqlSessionTemplate.selectOne(getSqlName(mapMethodName),joinuserid);
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户的未完成的贷款次数出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }
    
    @Override
    public List<TbSlLoanCreditLog> queryCreditByIdList(List<Integer> idlist) throws BusinessException {
        String mapMethodName = "select";
        Map<String,Object> map=new HashMap<>();
        map.put("idlist",idlist.toArray(new Integer[0]));
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),map);
            return list;
        } catch (Exception e) {
            throw new DaoException(String.format("批量用户的贷款查询记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public void cancelCredit() throws BusinessException {
        String mapMethodName ="cacelCredit";
        String curdate=TimeUtils.getCurDate();
        try{
            this.sqlSessionTemplate.update(getSqlName(mapMethodName),curdate);
        }catch (Exception e) {
            throw new DaoException(String.format("贷款日志表自动取消出错！语句：%s",
                    getSqlName(mapMethodName)),e);
        }
    }

    @Override
    public List<TbSlLoanCreditLog> queryCreditByJoinid(int joinid, Pageable page) throws BusinessException {
        String mapMethodName = "selectcreditByJoinid";
        try {
            return this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),joinid,getPageBounds(page));
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户的贷款表数据出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public void batchUpdateFile(List<Integer> idlist, String material) throws BusinessException {
        String mapMethodName = "batchupdateFile";
        Map<String,Object> map=new HashMap<>();
        map.put("idlist",idlist.toArray(new Integer[0]));
        map.put("material",material);
        try {
          this.sqlSessionTemplate.update(getSqlName(mapMethodName), map);

        } catch (Exception e) {
            throw new DaoException(String.format("批量用户的贷款上传的融资申请书记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public void batchUpateFileByProcessid(Integer process_info_id,String material) throws BusinessException {
        String mapMethodName = "batchupdateFileByProcessid";
        Map<String,Object> paramap=new HashMap<>();
        paramap.put("material",material);
        paramap.put("process_info_id",process_info_id);
        try {
            this.sqlSessionTemplate.update(getSqlName(mapMethodName), paramap);

        } catch (Exception e) {
            throw new DaoException(String.format("批量用户的贷款上传的融资申请书记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public List<TbSlNotPayBackCredit> queryCreditNotPayBack(int userIdOfIPayNowOfDebtor,Pageable page) throws BusinessException {
        String mapMethodName = "selectNotpaybackbyjoinid";
        try {
        	List list = null;
        	if (page == null) {
        		list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),userIdOfIPayNowOfDebtor);
        	} else {
        		list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),userIdOfIPayNowOfDebtor,getPageBounds(page));
        	}
            if (list != null && list.size() >0)
                return list ;
        } catch (Exception e) {
            throw new DaoException(String.format("查询商户的待还贷款数据出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
        return null;
    }

    @Override
    public void updateBatchCancel(List<Integer> list) throws BusinessException {
        String mapMethodName = "batchcancel";
        Map<String,Object> map=new HashMap<>();
        map.put("idlist",list.toArray(new Integer[0]));
        try {
            this.sqlSessionTemplate.update(getSqlName(mapMethodName), map);

        } catch (Exception e) {
            throw new DaoException(String.format("批量取消用户的贷款上传的融资申请书记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }



    @Override
    public void caculateCreditFee() throws BusinessException {
        String mapMethodName ="caculateFee";
        String curdate= TimeUtils.getCurDate();
        try{
            this.sqlSessionTemplate.update(getSqlName(mapMethodName),curdate);
        }catch (Exception e) {
            throw new DaoException(String.format("贷款日志表自动计息出错！语句：%s",
                    getSqlName(mapMethodName)),e);
        }
    }

    @Override
    public void caculateReneweFee() throws BusinessException {
        String mapMethodName ="caculateRenewedFee";
        String curdate= TimeUtils.getCurDate();
        try{
            this.sqlSessionTemplate.update(getSqlName(mapMethodName),curdate);
        }catch (Exception e) {
            throw new DaoException(String.format("贷款日志表自动计算展息出错！语句：%s",
                    getSqlName(mapMethodName)),e);
        }
    }

    @Override
    public void caculatePenalty() throws BusinessException {
        String mapMethodName ="caculatePenaltyFee";
        String curdate= TimeUtils.getCurDate();
        try{
            this.sqlSessionTemplate.update(getSqlName(mapMethodName),curdate);
        }catch (Exception e) {
            throw new DaoException(String.format("贷款日志表自动计算罚息出错！语句：%s",
                    getSqlName(mapMethodName)),e);
        }
    }

    @Override
    public List<SlLoanTodoTaskVO> queryToDoTask(Pageable  page) throws BusinessException {

        String mapMethodName = "queryLoanTodoTaskList";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),this.getPageBounds(page));
            if (list != null && list.size() >0)
                return list ;
        } catch (Exception e) {
            throw new DaoException(String.format("查询保理员的贷款待办事项出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
        return null;


    }

    @Override
    public List<TbSlLoanCreditLogVo> queryPayBackCreditLogByCause(Map map, Pageable page) throws BusinessException {
        String mapMethodName = "selectNotPayBackByCause";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),map,this.getPageBounds(page));
            if (list != null && list.size() >0)
                return list ;
        } catch (Exception e) {
            throw new DaoException(String.format("根据条件对供应链贷款对账查询记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
        return null;
    }

    @Override
    public List<TbSlLoanCreditLog> queryPaybackByJoinid(int userIdOfIPayNowOfDebtor, Pageable page) throws BusinessException {
        String mapMethodName = "selectpaybackbyjoinid";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),userIdOfIPayNowOfDebtor,getPageBounds(page));
            return list;
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户的已还款贷款查询记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }

    }

    @Override
    public List<TbSlLoanCreditLog> queryApplyByJoinid(int userIdOfIPayNowOfDebtor, Pageable page) throws BusinessException {
        String mapMethodName = "selectApply";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),userIdOfIPayNowOfDebtor,getPageBounds(page));
            return list;
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户的申请贷款查询记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }

    }

	@Override
	public void lockById(int id) throws BusinessException {
		 String mapMethodName = "lockid";

	        try {
	            this.sqlSessionTemplate.selectOne(getSqlName(mapMethodName),
	                     id);
	        } catch (Exception e) {
	            throw new DaoException(String.format("加锁出错->" + id + "出错！语句：%s",
	                    getSqlName(mapMethodName)), e);
	        }
		
	}

    @Override
    public List<TbSlLoanCreditLogForFront> queryTbSlLoanCreditLogForFront(int userIdOfIPayNowOfDebtor) throws BusinessException {
        String mapMethodName = "selectApplyedCreditMap";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),userIdOfIPayNowOfDebtor);
            return list;
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户的已申请贷款查询记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public void lockTable() throws BusinessException {
        String mapMethodName = "locktable";

        try {
            this.sqlSessionTemplate.selectList(getSqlName(mapMethodName));
        } catch (Exception e) {
            throw new DaoException(String.format("加锁出错->出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public List<TbSlNotPayBackCredit> queryCreditNotPayBackForSl(int userIdOfIPayNowOfDebtor) throws BusinessException {
        String mapMethodName = "selectNotpaybackbyjoinidforsl";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),userIdOfIPayNowOfDebtor);
            if (list != null && list.size() >0)
                return list ;
        } catch (Exception e) {
            throw new DaoException(String.format("查询商户的待还贷款数据出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
        return null;
    }

    @Override
    public List<TbSlLoanCreditLog> queryNotPayBack() throws BusinessException {
        String methodmap="calculateFee";
        String curdate=TimeUtils.getCurDate();
        try{
            List list=this.sqlSessionTemplate.selectList(getSqlName(methodmap),curdate);
            return list;
        }catch (Exception e){
            throw new DaoException(String.format("查询待还贷款数据出错！语句：%s",
                    getSqlName(methodmap)), e);
        }

    }

    @Override
    public void updateTbSlCreditvo(TbSlLoanCreditLog logvo) throws BusinessException {
        String mapMethodName ="updateByIdSelective";
        try{
             this.sqlSessionTemplate.update(getSqlName(mapMethodName), logvo);
        }catch (Exception e) {
            throw new DaoException(String.format("更新商户贷款出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public void cancelForPausedPlatform(Integer idOfPlatform) throws BusinessException {
        String mapMethodName ="cancel";
        Map<String,Object> paramap=new HashMap<>();
        paramap.put("idOfPlatform",idOfPlatform);
      //  paramap.put("userIdOfJoinOfDebtor",userIdOfJoinOfDebtor);
        try{
            this.sqlSessionTemplate.update(getSqlName(mapMethodName),paramap);
        }catch (Exception e) {
            throw new DaoException(String.format("贷款自动出错！语句：%s",
                    getSqlName(mapMethodName)),e);
        }
    }

    @Override
    public List<TbSlLoanCreditLog> queryWillExpire(Integer userIdOfJoinOfDebtor, String curdate,Pageable page) throws BusinessException {
        Map<String,Object> paramap=new HashMap<>();
        paramap.put("user_id_of_join_of_debtor",userIdOfJoinOfDebtor);
        paramap.put("curdate",curdate);
        String methodmap="selectWillExpireByJoinid";
           try{
               List list=this.sqlSessionTemplate.selectList(getSqlName(methodmap),paramap,getPageBounds(page));
               return list;
           }catch (Exception e){
               throw new DaoException(String.format("查询待还贷款数据出错！语句：%s",
                       getSqlName(methodmap)), e);
           }

    }

    @Override
    public List<TbSlStatusCreditLogVo> queryRenewedCredit(Integer userIdOfJoinOfCreditor,Integer userIdOfJoinOfDebtor,Integer idOfPlatform,String begintime,String endtime,Pageable page) throws BusinessException {

        String methodmap="selectrenewedcredit";
        Map<String,Object> param=new HashMap<>();
        param.put("curdate",TimeUtils.getCurDate());
        param.put("userIdOfJoinOfCreditor",userIdOfJoinOfCreditor);
        param.put("userIdOfJoinOfDebtor",userIdOfJoinOfDebtor);
        param.put("idOfPlatform",idOfPlatform);
        param.put("begintime",begintime);
        param.put("endtime",endtime);
        try{
            List list=this.sqlSessionTemplate.selectList(getSqlName(methodmap),param,getPageBounds(page));
            return list;
        }catch (Exception e){
            throw new DaoException(String.format("查询待展期的贷款数据出错！语句：%s",
                    getSqlName(methodmap)), e);
        }
    }

    @Override
    public List<TbSlLoanCreditLogVo> queryCreditForFloat(Map<String, Object> parammap,Pageable page) throws BusinessException {
        String methodmap="selectfloat";
        try{
            List list=this.sqlSessionTemplate.selectList(getSqlName(methodmap),parammap,getPageBounds(page));
            return list;
        }catch (Exception e){
            throw new DaoException(String.format("查询调差价的贷款数据出错！语句：%s",
                    getSqlName(methodmap)), e);
        }
    }

    @Override
    public List<TbSlCreditLogForExcelVO> queryCreditForExcel(int joinid) throws BusinessException {
        String methodmap="selectcreditforexcel";
        try{
            List list=this.sqlSessionTemplate.selectList(getSqlName(methodmap),joinid);
            return list;
        }catch (Exception e){
            throw new DaoException(String.format("查询展期的贷款数据出错！语句：%s",
                    getSqlName(methodmap)), e);
        }
    }

    @Override
    public List<TbSlLoanCreditLog> queryNotPaybackByPlatform(int idofplatform) throws BusinessException {
        Map<String,Object> parammap=new HashMap();
        parammap.put("id_of_platform",idofplatform);
        String methodmap="selectNotPaybackByPlatform";
        try{
            List list=this.sqlSessionTemplate.selectList(getSqlName(methodmap),parammap);
            return list;
        }catch (Exception e){
            throw new DaoException(String.format("查询平台的贷款数据出错！语句：%s",
                    getSqlName(methodmap)), e);
        }
    }

    @Override
    public TbSlStatusCreditLogVo queryStatusCreditLogVo(int id) throws BusinessException {

        String methodmap="selectDataByid";
        try{
            List<TbSlStatusCreditLogVo> list=this.sqlSessionTemplate.selectList(getSqlName(methodmap),id);
            if(!CommonUtils.isEmpty(list)){
                return list.get(0);
            } else{
                return null;
            }
        }catch (Exception e){
            throw new DaoException(String.format("查询贷款数据出错！语句：%s",
                    getSqlName(methodmap)), e);
        }
    }

    @Override
    public List<TbSlLoanCreditLog> queryCodeById(List<Integer> list) throws BusinessException {
        String mapMethodName = "selectCode";
        Map<String,Object> map=new HashMap<>();
        map.put("idlist",list.toArray(new Integer[0]));
        try {
           return this.sqlSessionTemplate.selectList(getSqlName(mapMethodName), map);

        } catch (Exception e) {
            throw new DaoException(String.format("批量查询用户的贷款上传的融资申请书记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public List<TbSlLoanCreditLog> queryTsById(List<Integer> idlist) throws BusinessException {
        String mapMethodName = "selecttsbyid";
        Map<String,Object> map=new HashMap<>();
        map.put("idlist",idlist.toArray(new Integer[0]));
        try {
            return this.sqlSessionTemplate.selectList(getSqlName(mapMethodName), map);

        } catch (Exception e) {
            throw new DaoException(String.format("批量查询用户的贷款记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public TbSlStatusCreditLogVo queryInfoById(Integer id) throws BusinessException {
        String mapMethodName="selectCreidLogById";
        try {
            return this.sqlSessionTemplate.selectOne(getSqlName(mapMethodName), id);
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户的贷款记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public void updateCreditLogForBatch(Map<String, Object> map) throws BusinessException {
        String mapMethodName="updateforbatch";
        try {
            this.sqlSessionTemplate.update(getSqlName(mapMethodName), map);

        } catch (Exception e) {
            throw new DaoException(String.format("批量更新用户的贷款记录的融资申请书记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public void updateForCancelCredit(Integer processid) throws BusinessException {
        String methodName="updateByProcessid";
        try {
            this.sqlSessionTemplate.update(getSqlName(methodName), processid);

        } catch (Exception e) {
            throw new DaoException(String.format("取消用户的贷款记录出错！语句：%s",
                    getSqlName(methodName)), e);
        }
    }

    @Override
    public List<TbSlStatusCreditLogVo> queryCreditByProcessid(Integer process_info_id) throws BusinessException {
        String mapMethodName="selectDataByProcessid";
        try {
            return this.sqlSessionTemplate.selectList(getSqlName(mapMethodName), process_info_id);
        } catch (Exception e) {
            throw new DaoException(String.format("根据流程id查询用户的贷款记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }
    }

    @Override
    public List<TbSlLoanCreditLogVo> queryNeedMessage() throws BusinessException {
        Map<String,Object>  param=new HashMap<>();
        param.put("curdate",TimeUtils.getCurDate());
        String methodmap="selectwillexpire";
        try{
            return  this.sqlSessionTemplate.selectList(getSqlName(methodmap),param);
        } catch (Exception e){
            throw new DaoException(String.format("查询还款期限还有十五天的记录报错,语句：%s",getSqlName(methodmap)),e);
        }
    }

    @Override
    public List<TbSlLoanCreditLogVo> queryWillExpireCreditForOperator(Pageable pageable) throws BusinessException {
        Map<String,Object>  param=new HashMap<>();
        param.put("curdate",TimeUtils.getCurDate());
        String methodmap="selectexpireforoperator";
        try{
            return  this.sqlSessionTemplate.selectList(getSqlName(methodmap),param,getPageBounds(pageable));
        } catch (Exception e){
            throw new DaoException(String.format("查询还款期限小于等于十五天的记录报错,语句：%s",getSqlName(methodmap)),e);
        }
    }

    @Override
    public List<SLLoanBillBaseInfoVo> queryLoanBillBaseInfoByTime(String begintime, String endtime, Integer userIdOfJoinOfDebtor, Integer userIdOfJoinOfCreditor,Pageable pageable) throws BusinessException {

        Map<String,Object>  param=new HashMap<>();
        param.put("begintime",begintime);
        param.put("endtime",endtime);
        param.put("userIdOfJoinOfDebtor",userIdOfJoinOfDebtor);
        param.put("userIdOfJoinOfCreditor",userIdOfJoinOfCreditor);
        String methodmap="selectbillbaseresult";
        try{
            return  this.sqlSessionTemplate.selectList(getSqlName(methodmap),param,getPageBounds(pageable));
        } catch (Exception e){
            throw new DaoException(String.format("查询对账的基本信息报错,语句：%s",getSqlName(methodmap)),e);
        }
    }

    @Override
    public List<SlLoanBillDetailVo> queryLoanBillDetailVo(String begintime, String endtime, Integer userIdOfJoinOfDebtor) throws BusinessException {
        Map<String,Object>  param=new HashMap<>();
        param.put("begintime",begintime);
        param.put("endtime",endtime);
        param.put("userIdOfJoinOfDebtor",userIdOfJoinOfDebtor);
        String methodmap="selectBillDetailresult";
        try{
            return  this.sqlSessionTemplate.selectList(getSqlName(methodmap),param);
        } catch (Exception e){
            throw new DaoException(String.format("查询对账的具体信息报错,语句：%s",getSqlName(methodmap)),e);
        }
    }

    @Override
    public SLLoanBillVo querySlLoanBillvo(String begintime, String endtime, Integer userIdOfJoinOfDebtor, Integer userIdOfJoinOfCreditor) throws BusinessException {
        Map<String,Object>  param=new HashMap<>();
        param.put("begintime",begintime);
        param.put("endtime",endtime);
        param.put("userIdOfJoinOfDebtor",userIdOfJoinOfDebtor);
        param.put("userIdOfJoinOfCreditor",userIdOfJoinOfCreditor);
        String methodmap="selectSlLoanBillVo";
        try{
            return  this.sqlSessionTemplate.selectOne(getSqlName(methodmap),param);
        } catch (Exception e){
            throw new DaoException(String.format("查询对账的总额报错,语句：%s",getSqlName(methodmap)),e);
        }
    }


}
